from django.views import View

from User.models import UserVip
from sportsground.utils.Res import Res
from sportsground.utils.views import LoginRequiredUser


class VipView(LoginRequiredUser, View):
    """ 会员卡信息 """

    def get(self, request):
        """ 查询 """
        user = request.user.user

        vips = UserVip.objects.filter(user=user)
        result = []
        for vip in vips:
            result.append(vip.Info())
        return Res.Json(Res.OK, result=result)
